package com.gather.orm;

public class Animal implements Comparable<Animal>{
    private int age;

    public Animal(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public int compareTo(Animal o) {
        // 小到大排序
        int a = this.age;
        int b = o.getAge();
        return a > b ? 1 : -1;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "age=" + age +
                '}';
    }
}
